#!/bin/bash

# startup
ssh root@${host} "
  cd ${REMOTE_DIR}/${app}
  # startup.sh
  echo '#!/bin/bash
  nohup java -server -Xms192m ${maxmemory} -XX:NewSize=192m -Dcatalina.base=${REMOTE_DIR}/${app} -jar ${app_jar} --server.port=${listenport} --profile=test > startup.log 2>&1 &
  echo \$! > run.pid
  ' > startup.sh

  chmod +x startup.sh
  sh startup.sh
"
[ $? -eq 0 ] || exit 1

